package cn.jhz.learn.blog.service.security.resource.photo.impl;

import cn.jhz.learn.blog.service.security.resource.photo.PhotoValidationService;

public class PhotoValidationServiceImpl implements PhotoValidationService {
    //    @Override
    //    public void albumSubfieldValid(Integer subfieldId) {
    //        BlogAlbumSubfield subfield = (BlogAlbumSubfield) ValidationHolder.getParam(BlogAlbumSubfield.class.getName() + subfieldId);
    //
    //        if(subfield == null) {
    //            subfield = albumSubfieldMapper.selectByPrimaryKey(subfieldId);
    //
    //            if (subfield == null || subfield.getStatus() != 1)
    //                throw new ParamException("分支不存在!");
    //            else {
    //                blogValid(subfield.getBlogId());
    //                if (subfield.getVisibility() != 1)
    //                    throw new ParamException("分支被隐藏!");
    //            }
    //            ValidationHolder.putParam(BlogAlbumSubfield.class.getName() + subfieldId, subfield);
    //        }
    //    }
    //
    //    @Override
    //    public void albumSubfieldValid(Integer uid, Integer subfieldId) {
    //        BlogBlogger user = ValidationHolder.getCurrentUser();
    //        BlogAlbumSubfield subfield = (BlogAlbumSubfield) ValidationHolder.getParam(BlogAlbumSubfield.class.getName() + subfieldId);
    //
    //        if(user == null || subfield == null){
    //            user = uidValid(uid);
    //            subfield = albumSubfieldMapper.selectByPrimaryKey(subfieldId);
    //            if(subfield == null)
    //                throw new ParamException("分支不存在!");
    //            else if(!subfield.getBlogId().equals(user.getId())){
    //                if (subfield.getVisibility() != 1)
    //                    throw new ParamException("分支被隐藏!");
    //                if(subfield.getStatus() != 1)
    //                    throw new ParamException("分支不存在!");
    //                ValidationHolder.putOwn(BlogAlbumSubfield.class.getName() + subfieldId, false);
    //            }else
    //                ValidationHolder.putOwn(BlogAlbumSubfield.class.getName() + subfieldId, true);
    //
    //            ValidationHolder.putParam(BlogAlbumSubfield.class.getName() + subfieldId, subfield);
    //        }
    //    }
    //
    //
    //    @Override
    //    public void photoSubfieldValid(Integer photoSubfieldId) {
    //        BlogPhotoSubfield subfield = (BlogPhotoSubfield) ValidationHolder.getParam("BlogPhotoSubfield" + photoSubfieldId);
    //
    //        if(subfield == null){
    //            subfield = photoSubfieldMapper.selectByPrimaryKey(photoSubfieldId);
    //            if(subfield == null || subfield.getStatus() != 1)
    //                throw new ParamException("相册不存在!");
    //            else{
    //                blogValid(subfield.getBlogId());
    //                if(subfield.getVisibility() != 1)
    //                    throw new ParamException("相册被隐藏!");
    //            }
    //            ValidationHolder.putParam(BlogPhotoSubfield.class.getName() + photoSubfieldId, subfield);
    //        }
    //    }
    //
    //    @Override
    //    public void photoSubfieldValid(Integer uid, Integer photoSubfieldId) {
    //        BlogPhotoSubfield subfield =
    //                (BlogPhotoSubfield) ValidationHolder.getParam(BlogPhotoSubfield.class.getName() + photoSubfieldId);
    //        BlogBlogger user = uidValid(uid);
    //
    //        if(subfield == null){
    //            subfield = photoSubfieldMapper.selectByPrimaryKey(photoSubfieldId);
    //
    //            if (subfield == null)
    //                throw new ParamException("相册不存在!");
    //            else if (!subfield.getBlogId().equals(user.getId())) {
    //                blogValid(subfield.getBlogId());
    //                if (subfield.getVisibility() != 1)
    //                    throw new ParamException("相册被隐藏!");
    //                else if (subfield.getStatus() != 1)
    //                    throw new ParamException("相册不存在!");
    //                ValidationHolder.putOwn(BlogPhotoSubfield.class.getName() + photoSubfieldId, false);
    //            } else
    //                ValidationHolder.putOwn(BlogPhotoSubfield.class.getName() + photoSubfieldId, true);
    //
    //            ValidationHolder.putParam(BlogPhotoSubfield.class.getName() + photoSubfieldId, subfield);
    //        }
    //    }
    //
}
